<?php
declare(strict_types=1);

namespace app\common\validate;

use think\Validate;

/**
 * | Notes：用户模型
 * +----------------------------------------------------------------------
 * | PHP Version 7.2+
 * +----------------------------------------------------------------------
 * | Copyright (c) 2011-2020 https://www.xxq.com.cn, All rights reserved.
 * +----------------------------------------------------------------------
 * | Author: 和好 <389123492@qq.com>
 * +----------------------------------------------------------------------
 * | Date: 2021/3/14 0:18
 * +----------------------------------------------------------------------
 */
class Member extends Validate
{
    // 验证规则
    protected  $rule = [
        'loginId'     => 'require',
        'username'    => 'require',
        'nickname'    => 'require|chsDash',
        'password'    => 'require',
        'repassword'  => 'require',
        'mobile'      => 'require',
        'email'       => 'require',
        'status'      => 'require',
        'client_type' => 'require',
        'verify_code' => 'require',
        'referee'     => 'require',
        'payment'     => 'require|number|length:6',
        'passwd'      => 'require',
        'repasswd'    => 'require',
        'safety_code' => 'require',
        'safecode'    => 'require',
        'resafecode'  => 'require',
    ];

    protected  $message = [
        'loginId.require'     => '请输入账户',
        'username.require'    => '请输入账户',
        'nickname.require'    => '请输入昵称',
        'nickname.chsDash'    => '不能含有特殊字符,请正确输入',
        'password.require'    => '请输入密码',
        'repassword.require'  => '请重新输入密码',
        'mobile.require'      => '请输入手机号码',
        'email.require'       => '请输入邮箱',
        'client_type.require' => '缺少客户端登录类型',
        'payment.require'     => '请输入支付密码',
        'payment.number'      => '仅支付数字,请正确输入',
        'verify_code.require' => '请输入验证码',
        'referee.require'     => '请输入推荐人信息',
        'passwd.require'      => '请输入新密码',
        'repasswd.require'    => '请重新输入新密码',
        'safety_code.require' => '请设置交易密码',
        'safecode.require'    => '请输入新的交易密码',
        'resafecode.require'  => '请确认交易密码',
    ];

    protected  $scene = [
        'login'          => ['loginId', 'password', 'client_type'],
        'register'       => ['mobile', 'password'],
        'wapRegister'    => ['mobile', 'password', 'repassword', 'verify_code', 'referee'],
        'appRegister'    => ['mobile', 'verify_code', 'referee'],
        'updateMobile'   => ['mobile'],
        'disabledMember' => ['id, status'],
        'setReferee'     => ['referee'],
        'resetPasswd'    => ['password', 'passwd', 'repasswd'],
        'safetyCode'     => ['safecode', 'resafecode'],
        'upgradeNode'    => ['safecode', 'resafecode'],
    ];
}